local mingzheng = fk.CreateSkill{
    name = "wk_heg__mingzheng",
}

Fk:loadTranslationTable{
    ["wk_heg__mingzheng"] = "明政",
    [":wk_heg__mingzheng"] = "与你势力相同角色：1.明置武将牌后，其复原武将牌并获得一个“阴阳鱼”标记; 2.出牌阶段开始时，其观看一名与你势力相同角色的手牌。",

    ["#wk_heg__mingzheng-choose"] = "明政：选择一名与你势力相同的其他角色观看手牌",
    ["wk_heg__mingzheng-hand"] = "明政：观看%dest的手牌",

    ["$wk_heg__mingzheng1"] = "仁政如水，可润万物",
    ["$wk_heg__mingzheng2"] = "为官一任，当造福一方",
}

local H = require "packages/ol_hegemony/util"

mingzheng:addEffect(fk.GeneralRevealed,{
    anim_type = "drawcard",
    can_trigger = function (self, event, target, player, data)
       return player:hasSkill(mingzheng.name) and H.compareKingdomWith(target, player) and not target.dead 
       -- and H.allGeneralsRevealed(target)
    end,
    on_cost = Util.TrueFunc,
    on_use = function (self, event, target, player, data)
        local room = player.room
        target:reset()
        H.addHegMark(room, target, "yinyangfish", 1)
    end,
})

mingzheng:addEffect(fk.EventPhaseStart,{
    anim_type = "drawcard",
    can_trigger = function (self, event, target, player, data)
       if not (player:hasSkill(mingzheng.name) and H.compareKingdomWith(target, player) and not target.dead) then return false end
        return target.phase == Player.Play
    end,
    on_cost = Util.TrueFunc,
    on_use = function (self, event, target, player, data)
      local room = player.room
        local targets = table.filter(room.alive_players, function(p) return H.compareKingdomWith(p, player) and p ~= target end)
        if #targets > 0 then
          local to = room:askToChoosePlayers(target,{
            targets = targets,
            min_num = 1,
            max_num = 1,
            prompt = "#wk_heg__mingzheng-choose",
            skill_name = mingzheng.name,
            cancelable = false,
          })
          local p = to[1]
          room:viewCards(target, {cards = p:getCardIds(Player.Hand), skill_name = mingzheng.name, prompt = "wk_heg__mingzheng-hand::"..p.id})
      end
    end,
})

return mingzheng